package com.esri.android.map.ags;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Log;
import com.esri.android.map.TiledServiceLayer;
import com.esri.android.map.event.OnStatusChangedListener;
import com.esri.core.ags.LOD;
import com.esri.core.ags.LayerServiceInfo;
import com.esri.core.ags.MapServiceCapabilities;
import com.esri.core.ags.MapServiceInfo;
import com.esri.core.ags.TileInfo;
import com.esri.core.geometry.Envelope;
import com.esri.core.geometry.GeometryEngine;
import com.esri.core.geometry.SpatialReference;
import com.esri.core.internal.a;
import com.esri.core.internal.io.handler.ResponseListener;
import com.esri.core.internal.tasks.ags.an;
import com.esri.core.internal.tasks.ags.ao;
import com.esri.core.internal.tasks.ags.t;
import com.esri.core.internal.tasks.e;
import com.esri.core.io.EsriSecurityException;
import com.esri.core.io.EsriServiceException;
import com.esri.core.io.UserCredentials;
import com.esri.core.map.CallbackListener;
import com.esri.core.map.Field;
import com.esri.core.map.popup.PopupFieldInfo;
import com.esri.core.map.popup.PopupInfo;
import java.io.ByteArrayInputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.concurrent.RejectedExecutionException;
import org.apache.http.Header;
import org.apache.http.HttpResponse;

/* loaded from: classes.dex */
public class ArcGISTiledMapServiceLayer extends TiledServiceLayer {
    String c;
    ResponseListener d;
    private ArcGISLayerInfo[] e;
    private ArcGISLayerInfo[] f;
    private MapServiceCapabilities g;
    private boolean s;
    private boolean t;
    private Map<Integer, LayerServiceInfo> u;

    public ArcGISTiledMapServiceLayer(String str) {
        this(str, null, true);
    }

    public ArcGISTiledMapServiceLayer(String str, UserCredentials userCredentials) {
        this(str, userCredentials, true);
    }

    public ArcGISTiledMapServiceLayer(String str, UserCredentials userCredentials, boolean z) {
        super(str);
        this.e = null;
        this.f = null;
        this.g = null;
        this.c = "";
        this.t = false;
        this.u = new HashMap();
        this.d = new ResponseListener() { // from class: com.esri.android.map.ags.ArcGISTiledMapServiceLayer.2
            @Override // com.esri.core.internal.io.handler.ResponseListener
            public boolean onResponseInterception(HttpResponse httpResponse) {
                Header[] headers = httpResponse.getHeaders("etag");
                return headers != null && headers.length > 0 && ArcGISTiledMapServiceLayer.this.c != null && ArcGISTiledMapServiceLayer.this.c.equals(headers[0].getValue());
            }
        };
        this.credentials = userCredentials;
        if (z) {
            try {
                getServiceExecutor().submit(new Runnable() { // from class: com.esri.android.map.ags.ArcGISTiledMapServiceLayer.1
                    @Override // java.lang.Runnable
                    public void run() {
                        ArcGISTiledMapServiceLayer.this.initLayer();
                    }
                });
            } catch (RejectedExecutionException unused) {
            }
        }
    }

    /* JADX INFO: Access modifiers changed from: protected */
    @Override // com.esri.android.map.TiledServiceLayer, com.esri.android.map.Layer
    public void initLayer() {
        if (getID() == 0) {
            this.nativeHandle = create();
        }
        if (getID() == 0) {
            changeStatus(OnStatusChangedListener.STATUS.fromInt(-1000));
            Log.e(a.a, "url =" + getUrl());
            return;
        }
        try {
            MapServiceInfo execute = this.serviceInfo != null ? (MapServiceInfo) this.serviceInfo : new t(getUrl(), this.credentials).execute();
            if (this.serviceInfo == null) {
                this.serviceInfo = execute;
            }
            if (execute == null) {
                throw new Exception("layer initialization failed due to invalid URL or credential");
            }
            if (getName() == null || getName().length() < 1) {
                setName(execute.getMapName());
            }
            this.g = execute.getCapabilities();
            this.t = execute.isExportTilesAllowed();
            setFullExtent(execute.getFullExtent());
            setDefaultSpatialReference(execute.getSpatialReference());
            initializeMinMaxScale(execute.getMinScale(), execute.getMaxScale());
            a(execute.getMapServiceLayerInfos());
            TileInfo tileInfo = execute.getTileInfo();
            if (tileInfo != null) {
                List<LOD> lODs = tileInfo.getLODs();
                int size = lODs.size();
                double[] dArr = new double[size];
                double[] dArr2 = new double[size];
                for (int i = 0; i < lODs.size(); i++) {
                    dArr[i] = lODs.get(i).getScale();
                    dArr2[i] = lODs.get(i).getResolution();
                }
                setTileInfo(new TiledServiceLayer.TileInfo(tileInfo.getOrigin(), dArr, dArr2, size, tileInfo.getDPI(), tileInfo.getCols(), tileInfo.getRows()));
            }
            Envelope initialExtent = getInitialExtent();
            if (initialExtent != null && !initialExtent.isEmpty()) {
                setInitialExtent((Envelope) GeometryEngine.project(getInitialExtent(), SpatialReference.create(4326), getDefaultSpatialReference()));
                super.initLayer();
                retrieveNoDataTileETag();
            }
            setInitialExtent(execute.getInitialExtent());
            super.initLayer();
            retrieveNoDataTileETag();
        } catch (Exception e) {
            Log.e(a.a, "url =" + getUrl(), e);
            if (e instanceof EsriSecurityException) {
                changeStatus(OnStatusChangedListener.STATUS.fromInt(((EsriSecurityException) e).getCode()));
            } else {
                changeStatus(OnStatusChangedListener.STATUS.fromInt(OnStatusChangedListener.EsriStatusException.INIT_FAILED_ARCGIS_TILE_LAYER));
            }
        }
    }

    void a(LayerServiceInfo[] layerServiceInfoArr) {
        if (layerServiceInfoArr != null) {
            ArrayList arrayList = new ArrayList();
            this.f = ArcGISDynamicMapServiceLayer.a(layerServiceInfoArr, arrayList, (int[]) null, (int[]) null);
            this.e = (ArcGISLayerInfo[]) arrayList.toArray(new ArcGISLayerInfo[0]);
            return;
        }
        this.e = new ArcGISLayerInfo[0];
    }

    public MapServiceInfo getMapServiceInfo() {
        if (this.serviceInfo instanceof MapServiceInfo) {
            return (MapServiceInfo) this.serviceInfo;
        }
        return null;
    }

    public ArcGISLayerInfo[] getLayers() {
        return this.e;
    }

    public ArcGISLayerInfo[] getAllLayers() {
        return this.f;
    }

    public MapServiceCapabilities getCapabilities() {
        return this.g;
    }

    @Override // com.esri.android.map.Layer
    @Deprecated
    public ArcGISPopupInfo getPopupInfo(int i) {
        ArcGISPopupInfo popupInfo = super.getPopupInfo(i);
        if (popupInfo != null && popupInfo.a == null) {
            try {
                popupInfo.fetchLayerInfo(popupInfo.c, this.credentials);
            } catch (Exception e) {
                Log.e(a.a, "url =" + getUrl(), e);
            }
        }
        return popupInfo;
    }

    @Override // com.esri.android.map.Layer
    public final String getQueryUrl(int i) {
        String queryUrl = super.getQueryUrl(i);
        if (queryUrl != null) {
            return queryUrl;
        }
        MapServiceInfo mapServiceInfo = getMapServiceInfo();
        if (mapServiceInfo == null) {
            return null;
        }
        LayerServiceInfo[] mapServiceLayerInfos = mapServiceInfo.getMapServiceLayerInfos();
        if (mapServiceLayerInfos != null) {
            for (LayerServiceInfo layerServiceInfo : mapServiceLayerInfos) {
                if (layerServiceInfo.getId() == i && (layerServiceInfo.getSubLayerIds() == null || (layerServiceInfo.getSubLayerIds() != null && layerServiceInfo.getSubLayerIds().size() == 0))) {
                    return getUrl() + "/" + i;
                }
            }
            return queryUrl;
        }
        return queryUrl;
    }

    @Deprecated
    public ArcGISPopupInfo createPopupInfo(int i) {
        Field[] fields;
        ArcGISPopupInfo popupInfo = getPopupInfo(i);
        if (popupInfo == null) {
            popupInfo = new ArcGISPopupInfo(new PopupInfo());
            try {
                popupInfo.fetchLayerInfo(getUrl() + "/" + i, this.credentials);
                LinkedHashMap linkedHashMap = new LinkedHashMap();
                for (Field field : popupInfo.a.getFields()) {
                    PopupFieldInfo popupFieldInfo = new PopupFieldInfo();
                    popupFieldInfo.setFieldName(field.getName());
                    popupFieldInfo.setLabel(field.getAlias());
                    linkedHashMap.put(field.getName(), popupFieldInfo);
                }
                popupInfo.setFieldInfos(linkedHashMap);
            } catch (Exception e) {
                Log.e(a.a, "url =" + getUrl(), e);
            }
        }
        return popupInfo;
    }

    public Future<ArcGISPopupInfo> createPopupInfo(final int i, final CallbackListener<ArcGISPopupInfo> callbackListener) {
        return e.b.submit(new Callable<ArcGISPopupInfo>() { // from class: com.esri.android.map.ags.ArcGISTiledMapServiceLayer.3
            /* JADX WARN: Removed duplicated region for block: B:43:0x0128  */
            @Override // java.util.concurrent.Callable
            /* renamed from: a */
            /*
                Code decompiled incorrectly, please refer to instructions dump.
                To view partially-correct code enable 'Show inconsistent code' option in preferences
            */
            public com.esri.android.map.ags.ArcGISPopupInfo call() throws java.lang.Exception {
                /*
                    Method dump skipped, instructions count: 302
                    To view this dump change 'Code comments level' option to 'DEBUG'
                */
                throw new UnsupportedOperationException("Method not decompiled: com.esri.android.map.ags.ArcGISTiledMapServiceLayer.AnonymousClass3.call():com.esri.android.map.ags.ArcGISPopupInfo");
            }
        });
    }

    public Future<ArcGISPopupInfo> fetchPopupInfo(final int i, final CallbackListener<ArcGISPopupInfo> callbackListener) {
        return e.b.submit(new Callable<ArcGISPopupInfo>() { // from class: com.esri.android.map.ags.ArcGISTiledMapServiceLayer.4
            /* JADX WARN: Removed duplicated region for block: B:29:0x0090  */
            @Override // java.util.concurrent.Callable
            /* renamed from: a */
            /*
                Code decompiled incorrectly, please refer to instructions dump.
                To view partially-correct code enable 'Show inconsistent code' option in preferences
            */
            public com.esri.android.map.ags.ArcGISPopupInfo call() throws java.lang.Exception {
                /*
                    r5 = this;
                    com.esri.android.map.ags.ArcGISTiledMapServiceLayer r0 = com.esri.android.map.ags.ArcGISTiledMapServiceLayer.this
                    int r1 = r2
                    com.esri.android.map.ags.ArcGISPopupInfo r0 = com.esri.android.map.ags.ArcGISTiledMapServiceLayer.b(r0, r1)
                    java.lang.Thread r1 = java.lang.Thread.currentThread()     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    boolean r1 = r1.isInterrupted()     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    if (r1 != 0) goto L76
                    if (r0 == 0) goto L6e
                    com.esri.core.ags.LayerServiceInfo r1 = r0.a     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    if (r1 != 0) goto L6e
                    com.esri.android.map.ags.ArcGISTiledMapServiceLayer r1 = com.esri.android.map.ags.ArcGISTiledMapServiceLayer.this     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    java.util.Map r1 = com.esri.android.map.ags.ArcGISTiledMapServiceLayer.a(r1)     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    int r2 = r2     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    java.lang.Integer r2 = java.lang.Integer.valueOf(r2)     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    java.lang.Object r1 = r1.get(r2)     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    com.esri.core.ags.LayerServiceInfo r1 = (com.esri.core.ags.LayerServiceInfo) r1     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    r0.a = r1     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    com.esri.core.ags.LayerServiceInfo r1 = r0.a     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    if (r1 != 0) goto L6e
                    com.esri.core.internal.tasks.ags.v r1 = new com.esri.core.internal.tasks.ags.v     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    java.lang.StringBuilder r2 = new java.lang.StringBuilder     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    r2.<init>()     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    com.esri.android.map.ags.ArcGISTiledMapServiceLayer r3 = com.esri.android.map.ags.ArcGISTiledMapServiceLayer.this     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    java.lang.String r3 = r3.getUrl()     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    r2.append(r3)     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    java.lang.String r3 = "/"
                    r2.append(r3)     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    int r3 = r2     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    r2.append(r3)     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    java.lang.String r2 = r2.toString()     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    com.esri.android.map.ags.ArcGISTiledMapServiceLayer r3 = com.esri.android.map.ags.ArcGISTiledMapServiceLayer.this     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    com.esri.core.io.UserCredentials r3 = com.esri.android.map.ags.ArcGISTiledMapServiceLayer.d(r3)     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    r1.<init>(r2, r3)     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    com.esri.core.ags.LayerServiceInfo r1 = r1.execute()     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    r0.a = r1     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    com.esri.android.map.ags.ArcGISTiledMapServiceLayer r1 = com.esri.android.map.ags.ArcGISTiledMapServiceLayer.this     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    java.util.Map r1 = com.esri.android.map.ags.ArcGISTiledMapServiceLayer.a(r1)     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    int r2 = r2     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    java.lang.Integer r2 = java.lang.Integer.valueOf(r2)     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    com.esri.core.ags.LayerServiceInfo r3 = r0.a     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    r1.put(r2, r3)     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                L6e:
                    com.esri.core.map.CallbackListener r1 = r3
                    if (r1 == 0) goto L75
                    r1.onCallback(r0)
                L75:
                    return r0
                L76:
                    java.lang.InterruptedException r1 = new java.lang.InterruptedException     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    r1.<init>()     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                    throw r1     // Catch: java.lang.Throwable -> L7c java.lang.Exception -> L7e
                L7c:
                    r1 = move-exception
                    goto L8c
                L7e:
                    r0 = move-exception
                    r1 = 0
                    com.esri.core.map.CallbackListener r2 = r3     // Catch: java.lang.Throwable -> L88
                    if (r2 == 0) goto L87
                    r2.onError(r0)     // Catch: java.lang.Throwable -> L88
                L87:
                    throw r0     // Catch: java.lang.Throwable -> L88
                L88:
                    r0 = move-exception
                    r4 = r1
                    r1 = r0
                    r0 = r4
                L8c:
                    com.esri.core.map.CallbackListener r2 = r3
                    if (r2 == 0) goto L93
                    r2.onCallback(r0)
                L93:
                    throw r1
                */
                throw new UnsupportedOperationException("Method not decompiled: com.esri.android.map.ags.ArcGISTiledMapServiceLayer.AnonymousClass4.call():com.esri.android.map.ags.ArcGISPopupInfo");
            }
        });
    }

    public LayerServiceInfo getLayerServiceInfo(int i) {
        Map<Integer, LayerServiceInfo> map = this.u;
        if (map == null) {
            return null;
        }
        return map.get(Integer.valueOf(i));
    }

    public Future<LayerServiceInfo> fetchLayerServiceInfo(final int i, final CallbackListener<LayerServiceInfo> callbackListener) {
        return e.b.submit(new Callable<LayerServiceInfo>() { // from class: com.esri.android.map.ags.ArcGISTiledMapServiceLayer.5
            /* JADX WARN: Removed duplicated region for block: B:25:0x007a  */
            @Override // java.util.concurrent.Callable
            /* renamed from: a */
            /*
                Code decompiled incorrectly, please refer to instructions dump.
                To view partially-correct code enable 'Show inconsistent code' option in preferences
            */
            public com.esri.core.ags.LayerServiceInfo call() throws java.lang.Exception {
                /*
                    r5 = this;
                    com.esri.android.map.ags.ArcGISTiledMapServiceLayer r0 = com.esri.android.map.ags.ArcGISTiledMapServiceLayer.this
                    java.util.Map r0 = com.esri.android.map.ags.ArcGISTiledMapServiceLayer.a(r0)
                    int r1 = r2
                    java.lang.Integer r1 = java.lang.Integer.valueOf(r1)
                    java.lang.Object r0 = r0.get(r1)
                    com.esri.core.ags.LayerServiceInfo r0 = (com.esri.core.ags.LayerServiceInfo) r0
                    java.lang.Thread r1 = java.lang.Thread.currentThread()     // Catch: java.lang.Throwable -> L66 java.lang.Exception -> L68
                    boolean r1 = r1.isInterrupted()     // Catch: java.lang.Throwable -> L66 java.lang.Exception -> L68
                    if (r1 != 0) goto L60
                    if (r0 != 0) goto L58
                    com.esri.core.internal.tasks.ags.v r1 = new com.esri.core.internal.tasks.ags.v     // Catch: java.lang.Throwable -> L66 java.lang.Exception -> L68
                    java.lang.StringBuilder r2 = new java.lang.StringBuilder     // Catch: java.lang.Throwable -> L66 java.lang.Exception -> L68
                    r2.<init>()     // Catch: java.lang.Throwable -> L66 java.lang.Exception -> L68
                    com.esri.android.map.ags.ArcGISTiledMapServiceLayer r3 = com.esri.android.map.ags.ArcGISTiledMapServiceLayer.this     // Catch: java.lang.Throwable -> L66 java.lang.Exception -> L68
                    java.lang.String r3 = r3.getUrl()     // Catch: java.lang.Throwable -> L66 java.lang.Exception -> L68
                    r2.append(r3)     // Catch: java.lang.Throwable -> L66 java.lang.Exception -> L68
                    java.lang.String r3 = "/"
                    r2.append(r3)     // Catch: java.lang.Throwable -> L66 java.lang.Exception -> L68
                    int r3 = r2     // Catch: java.lang.Throwable -> L66 java.lang.Exception -> L68
                    r2.append(r3)     // Catch: java.lang.Throwable -> L66 java.lang.Exception -> L68
                    java.lang.String r2 = r2.toString()     // Catch: java.lang.Throwable -> L66 java.lang.Exception -> L68
                    com.esri.android.map.ags.ArcGISTiledMapServiceLayer r3 = com.esri.android.map.ags.ArcGISTiledMapServiceLayer.this     // Catch: java.lang.Throwable -> L66 java.lang.Exception -> L68
                    com.esri.core.io.UserCredentials r3 = com.esri.android.map.ags.ArcGISTiledMapServiceLayer.e(r3)     // Catch: java.lang.Throwable -> L66 java.lang.Exception -> L68
                    r1.<init>(r2, r3)     // Catch: java.lang.Throwable -> L66 java.lang.Exception -> L68
                    com.esri.core.ags.LayerServiceInfo r0 = r1.execute()     // Catch: java.lang.Throwable -> L66 java.lang.Exception -> L68
                    com.esri.android.map.ags.ArcGISTiledMapServiceLayer r1 = com.esri.android.map.ags.ArcGISTiledMapServiceLayer.this     // Catch: java.lang.Throwable -> L66 java.lang.Exception -> L68
                    java.util.Map r1 = com.esri.android.map.ags.ArcGISTiledMapServiceLayer.a(r1)     // Catch: java.lang.Throwable -> L66 java.lang.Exception -> L68
                    int r2 = r2     // Catch: java.lang.Throwable -> L66 java.lang.Exception -> L68
                    java.lang.Integer r2 = java.lang.Integer.valueOf(r2)     // Catch: java.lang.Throwable -> L66 java.lang.Exception -> L68
                    r1.put(r2, r0)     // Catch: java.lang.Throwable -> L66 java.lang.Exception -> L68
                L58:
                    com.esri.core.map.CallbackListener r1 = r3
                    if (r1 == 0) goto L5f
                    r1.onCallback(r0)
                L5f:
                    return r0
                L60:
                    java.lang.InterruptedException r1 = new java.lang.InterruptedException     // Catch: java.lang.Throwable -> L66 java.lang.Exception -> L68
                    r1.<init>()     // Catch: java.lang.Throwable -> L66 java.lang.Exception -> L68
                    throw r1     // Catch: java.lang.Throwable -> L66 java.lang.Exception -> L68
                L66:
                    r1 = move-exception
                    goto L76
                L68:
                    r0 = move-exception
                    r1 = 0
                    com.esri.core.map.CallbackListener r2 = r3     // Catch: java.lang.Throwable -> L72
                    if (r2 == 0) goto L71
                    r2.onError(r0)     // Catch: java.lang.Throwable -> L72
                L71:
                    throw r0     // Catch: java.lang.Throwable -> L72
                L72:
                    r0 = move-exception
                    r4 = r1
                    r1 = r0
                    r0 = r4
                L76:
                    com.esri.core.map.CallbackListener r2 = r3
                    if (r2 == 0) goto L7d
                    r2.onCallback(r0)
                L7d:
                    throw r1
                */
                throw new UnsupportedOperationException("Method not decompiled: com.esri.android.map.ags.ArcGISTiledMapServiceLayer.AnonymousClass5.call():com.esri.core.ags.LayerServiceInfo");
            }
        });
    }

    @Override // com.esri.android.map.TiledServiceLayer
    protected byte[] getTile(int i, int i2, int i3) throws Exception {
        an anVar = new an(new ao(i, i2, i3), getUrl(), this.credentials);
        anVar.setResponseListener(this.d);
        return anVar.execute();
    }

    protected void retrieveNoDataTileETag() {
        ResponseListener responseListener = new ResponseListener() { // from class: com.esri.android.map.ags.ArcGISTiledMapServiceLayer.6
            @Override // com.esri.core.internal.io.handler.ResponseListener
            public boolean onResponseInterception(HttpResponse httpResponse) {
                Header[] headers = httpResponse.getHeaders("etag");
                if (headers == null || headers.length <= 0) {
                    return true;
                }
                ArcGISTiledMapServiceLayer.this.c = headers[0].getValue();
                return true;
            }
        };
        an anVar = new an(new ao(-1, 0, 0), getUrl(), this.credentials);
        anVar.setResponseListener(responseListener);
        try {
            anVar.execute();
        } catch (EsriServiceException unused) {
            this.c = null;
            Log.i(a.a, "No data tile ETag couldn't be retrieved");
        } catch (Exception e) {
            this.c = null;
            Log.e(a.a, "No data tile ETag couldn't be retrieved", e);
        }
        try {
            anVar.setResponseListener(null);
            Bitmap decodeStream = BitmapFactory.decodeStream(new ByteArrayInputStream(anVar.execute()));
            boolean z = true;
            for (int i = 0; i != decodeStream.getWidth(); i++) {
                int i2 = 0;
                while (true) {
                    if (i2 == decodeStream.getHeight()) {
                        break;
                    } else if ((decodeStream.getPixel(i, i2) & (-16777216)) != 0) {
                        z = false;
                        break;
                    } else {
                        i2++;
                    }
                }
            }
            decodeStream.recycle();
            if (z) {
                this.c = null;
            }
        } catch (Exception e2) {
            Log.e(a.a, "No data tile ETag couldn't be retrieved", e2);
        }
    }

    public boolean retrieveLegendInfo() {
        if (!this.s && isShowLegend()) {
            this.s = ArcGISDynamicMapServiceLayer.a((MapServiceInfo) this.serviceInfo, this.f, getCredentials());
        }
        return this.s;
    }

    public boolean isExportTilesAllowed() {
        return this.t;
    }
}
